package com.healthcloud.controller;


import com.healthcloud.entity.TestProjectItem;
import com.healthcloud.entity.TestProjectItemConclusion;
import com.healthcloud.service.TestProjectItemConclusionService;
import com.healthcloud.service.TestProjectService;
import com.healthcloud.utils.ApiRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * 检测项目rest服务控制器
 *
 * Created by houxianghua on 2015/7/23.
 */
@ApiIgnore
@RestController
@RequestMapping("/app/testProject")
public class TestProjectApiController {
	@Autowired
	private TestProjectItemConclusionService testProjectItemConclusionService;
	@Autowired
	private TestProjectService testProjectService;

	/**
	 * 获取检测项目建议
	 * @param request
	 * @return JsonMsg
	 */
	@RequestMapping(value = "/testProjectItemConclusion/get", method = RequestMethod.POST)
	public Object testProjectItemConclusionGet(HttpServletRequest request) {
		List<TestProjectItemConclusion> dataList = new ArrayList<>();
		ApiRes jm = new ApiRes(dataList);
		dataList = testProjectItemConclusionService.findByEntityAll(new TestProjectItemConclusion());
		jm.setData(dataList);
		jm.setSuccess(true);
		return jm;
	}

	/**
	 * 获取检测项目(子项)
	 * @param request
	 * @return JsonMsg
	 */
	@RequestMapping(value = "/testProjectItem/get", method = RequestMethod.POST)
	public Object testProjectItemGet(HttpServletRequest request) {
		List<TestProjectItem> dataList = new ArrayList<>();
		ApiRes jm = new ApiRes(dataList);
		dataList = testProjectService.findByEntityAll(new TestProjectItem());
		jm.setData(dataList);
		jm.setSuccess(true);
		return jm;
	}

}
